package com.example.platformhimybodymanage.config.rabbitmq;

import org.springframework.amqp.core.DirectExchange;
import org.springframework.amqp.core.FanoutExchange;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 交换机配置 一个交换机可以配置多个
 * 
 * @author Dhjie
 *
 */
@Configuration
public class ExchangeConfig {
	/**
	 * 路由模式交换机
	 * 
	 * @return
	 */
	@Bean
	public DirectExchange PayExchange() {
		return new DirectExchange(RabbitMQConfig.DIRCT_EXCHANGE, true, false);
	}

	@Bean
	public DirectExchange shouExchange() {
		return new DirectExchange(RabbitMQConfig.DIRCT_EXCHANGE, true, false);
	}

	/**
	 * 广播模式交换机
	 * 
	 * @return
	 */
	@Bean
	public FanoutExchange fanoutExchange() {

		return new FanoutExchange(RabbitMQConfig.FANOUT_EXCHANGE);
	}
}
